import request from '@/utils/request'

const prePath = "/schedule";

//获取定时任务分页
export function getScheduleJobPage(params) {
    return request({
        url: prePath + '/job/page',
        method: 'get',
        params
    })
}

//创建定时任务
export function createScheduleJob(data) {
    return request({
        url: prePath + '/job',
        method: 'post',
        data
    })
}

//更新定时任务
export function updateScheduleJob(data) {
    return request({
        url: prePath + '/job',
        method: 'put',
        data
    })
}

//删除定时任务
export function deleteScheduleJob(data) {
    return request({
        url: prePath + '/job',
        method: 'delete',
        data
    })
}

//发布定时任务
export function scheduleScheduleJob(id) {
    return request({
        url: prePath + '/job/schedule/' + id,
        method: 'post'
    })
}

//重发布定时任务
export function rescheduleScheduleJob(id) {
    return request({
        url: prePath + '/job/reschedule/' + id,
        method: 'post'
    })
}

//停止定时任务
export function stopScheduleJob(id) {
    return request({
        url: prePath + '/job/stop/' + id,
        method: 'post'
    })
}
export function executeScheduleJob(id) {
    return request({
        url: prePath + '/job/execute/' + id,
        method: 'post'
    })
}
